home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
bbs
/
mhis020.zip
/
LISTDAYS.MEX
< prev
next >
Wrap
Text File
|
1996-12-09
|
4KB
|
139 lines
#include <max.mh>
#include <input.mh>
#include "callstat.mh"
#include "callcrit.mh"
#include "callers.mh"
#include "float.mh"
#include "callutil.mh"
#include "upchar.mh"
#include "file.mh"
#define SECONDS_IN_DAY (86400)
#define LEGEND_FILE "history\\dayslgnd"
#define HELP_FILE "history\\dayskeys"
#define SPINNER_FILE "history\\spinner"
int: more_count;
int custom_more () {
char: key;
more_count := more_count + 1;
if (more_count >= usr.len - 1) {
more_count := 0;
for (;;) {
print (COL_LBLUE, "More ", COL_YELLOW, "[Y,n,l,?=help]: ");
while (kbhit ()) getch ();
show_file (SPINNER_FILE);
key := getch ();
print (COL_CYAN, key,'\n');
key := upChar (key);
if (key = 'N') {return False;}
else if (key = 'L') {show_file (LEGEND_FILE);}
else if (key = '?') {show_file (HELP_FILE);}
else if ((key = 'Y') or (key = '\r')) {return True;}
else print ("Sorry... unknown command: ", key, '\n');
};
};
return True;
}
void show_call_stats (string: last_date, struct _callstats: stats) {
if (last_date = "") return;
print (' ',
COL_LGREEN, last_date,
COL_LMAGENTA, strpadleft (itostr(stats.time * 100 / SECONDS_IN_DAY) + "%",8, ' '),
COL_LRED, strpadleft (itostr (stats.calls), 6, ' '),
COL_YELLOW, strpadleft (itostr (stats.filesup), 5, ' '),
COL_LBLUE, strpadleft (itostr (stats.kbup), 7, ' '),
COL_YELLOW, strpadleft (itostr (stats.filesdn), 5, ' '),
COL_LBLUE, strpadleft (itostr (stats.kbdn), 7, ' '),
COL_LCYAN, strpadleft (itostr (stats.read), 7, ' '),
COL_LMAGENTA, strpadleft (itostr (stats.posted), 7, ' '),
COL_MAGENTA, strpadleft (itostr (stats.paged), 5, ' '),
"\n");
}
void list_days () {
long: calls;
char: nonstop;
struct _callinfo: ci;
struct _callstats: stats;
string: last_date;
int: last_day;
calls := call_numrecs();
// reset_more(nonstop);
print (COL_WHITE);
print ("┌────────┬───────┬─────┬────┬──────┬────┬──────┬──────┬──────┬────┐\n");
print ("│ Date │Traffic│Calls│ Uploads │ Downloads │ Messages │Page│\n");
print ("│ │ │ │ # Kb │ # Kb │ Read Post │ │\n");
print ("└────────┴───────┴─────┴────┴──────┴────┴──────┴──────┴──────┴────┘\n");
more_count := 3;
while (call_read(callers.index, ci)
AND kbhit () = False) {
if (ci.login.date.day <> last_day) {
if (last_day > 0) {
show_call_stats (last_date, stats);
};
if (custom_more () = False) return;
last_date := date_string (ci.login.date);
last_day := ci.login.date.day;
stats_clear (stats);
};
if (meets_criteria (ci, callers.criteria)) {
stats_add (stats, ci);
// print(COL_LCYAN, strpad(ci.name,25,' '),
// COL_LMAGENTA, strpadleft(itostr(ci.task),5,' '),
// COL_LRED, strpadleft(itostr(ci.calls),6,' '), ' ',
// COL_YELLOW, strpad(time_to_string(ci.login.time),6,' '),
// COL_WHITE, strpadleft (itostr (time_online (ci) / 60), 3, ' '), ' ',
// COL_LBLUE, strpad(flag_string (ci.flags), 10, ' '),
// '\n');
};
if (callers.forward_search) {
callers.index := callers.index + 1;
}
else {
callers.index := callers.index - 1;
};
}
show_call_stats (last_date, stats);
if (kbhit ()) {
print (COL_WHITE + "Aborted\n");
while (kbhit ()) getch ();
};
if (callers.index >= calls or callers.index < 0) {
print (COL_WHITE + "End of callers log\n");
};
}
int main () {
string: result;
long: start, end;
struct _callstats: stats;
read_callers ();
input_str (result, INPUT_NLB_LINE + INPUT_DEFAULT, 0, 80,
COL_WHITE + "\nEnter call number, date, '=' for current, or <enter> for first: " + COL_CYAN);
if (call_open() = False) {
print ("Cannot open callers.dat!!\n");
};
callers.index := caller_index (result);
list_days ();
call_close ();
write_callers ();
}